<?php

/**
 * User: @lixu
 * Date: 2019-05-28
 * Time: 11:09
 */

use Biz\service\wiki\Wiki as sWiki;
use Biz\service\wiki\GoodThing as sGoodThing;


class GoodThingAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_NOTHING;

    public function main()
    {
        $page = $this->getRequest()->getQuery('page', 1);
        $page = $page < 1 ? 1 : abs($page);
        $wikiList = sGoodThing::getList($this->uid, $page);

        $list = [];
        if($wikiList['list']) {
            foreach ($wikiList['list'] as $wiki) {
                $list['list'][] = [
                    'type' => 1007,
                    'wiki_info' => $wiki
                ];
            }
        }
        $list['is_over'] = $wikiList['is_over'];

        $this->setSuccess($list);
    }
}